import re


def get_replace(data, cls):
    # print(data, type(data))
    while re.search('#(.+?)#', data):
        res2 = re.search('#(.+?)#', data)
        v = res2.group()
        k = res2.group(1)
        value = getattr(cls, k)
        # 进行替换
        data = data.replace(v, str(value))
    # print(data, type(data))
    return data

def get_replace_data(data, *args):
    for i in args:
        while re.search('#(.+?)#', data):
            res2 = re.search('#(.+?)#', data)
            v = res2.group()
            k = res2.group(1)
            data = data.replace(v, str(i))
            break
    # print(data, type(data))
    return data

# data = '{"name":"#name#","id":"#id#"}'
# num = "tang"
# get_replace_data(data, num, 100 )